Repository navigation
feat: Improve shared media - #2751
Conversation
Ivansss
left a comment
There was a problem hiding this comment.
Two issues from the new pagination:
Empty first page stops loading
If every item on the first page is filtered out (unshared files), nothing is appended, and loadMoreItemsIfNearBottom returns early because the list is still empty:
guard self.hasMore, !self.isLoading, !self.currentItems.isEmpty else { return }The user then sees "No shared items" while hasMore is still true. On main, the "Show more" button was based on the unfiltered count, so this didn't happen.
Maybe we could drop !self.currentItems.isEmpty from the guard? isLoading should already prevent duplicate requests.
Media viewer can stop at the end of the loaded items
mediaViewerMessage(before:) starts loading the next page but returns nil while that load is still running:
if self.currentItems.count - index <= Self.mediaViewerPrefetchDistance {
self.loadMoreItems()
}
return self.currentItems[(index + 1)...].first(where: { NCMediaViewerViewController.canShowMedia(of: $0) })UIPageViewController takes the nil as the end and doesn't ask again once the items arrive, so swiping fast through a long history gets stuck until you swipe back and forth.
Maybe we could refresh the viewer's adjacent pages after appendItems (resetting its current page via setViewControllers)?
Apart from that, the rest of the PR looks awesome :)
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Assisted-by: ClaudeCode:claude-opus-5.5 Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
ab44c7a to
2f84db7
Compare
|
Adjusted and added some more fixes ;) |
馃 AI (if applicable)